<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<style type="text/css">
			div{
				line-height: 500px;
				/*background: pink;*/
				text-align: center;
				font-size: 100px;
			}
		</style>
	</head>
	<body>
		<div>1</div>
		
		<script type="text/javascript">
			var d1=document.getElementsByTagName("div")[0];
			window.onresize=function(){
				rs();
			}
			function size(){
				var timer;
				return function(){
					if(timer){clearTimeout(timer)}
					timer=setTimeout(function(){
						if(innerWidth>996){
							d1.style.background="pink";
						}else{
							d1.style.background="green";						
						}
					},1000)
				}
			}
			var rs=size();
			window.onresize();
		</script>
	</body>
</html>
